<?xml version="1.0" encoding="ISO-8859-1"?>
<!DOCTYPE composition PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
    "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" xmlns:s="http://jboss.com/products/seam/taglib"
	xmlns:ui="http://java.sun.com/jsf/facelets" xmlns:f="http://java.sun.com/jsf/core"
	xmlns:h="http://java.sun.com/jsf/html" 
	xmlns:r="http://richfaces.org/rich" 
	xmlns:a="http://richfaces.org/a4j"
	xmlns:p="http://primefaces.prime.com.tr/ui"
	xmlns:ad="http://agiledev.com.br/fieldset">
	
	<ui:component>
	
		<h:form id="formItem">
	
			<s:decorate template="/layout/comands.xhtml">
				<a:commandButton value="#{messages.gravar}" actionListener="#{mb.persistItem}" data="#{eventContext.get('controle')}" reRender="#{rr},formItem" oncomplete="if(data == 'sucesso'){Richfaces.hideModalPanel('mpItem');}"/>
				<h:outputText value=" " />
				<a:commandButton value="#{messages.excluir}" actionListener="#{mb.removeItem}" data="#{eventContext.get('controle')}" reRender="#{rr},formItem" rendered="#{not empty item.oid}" oncomplete="if(data == 'sucesso'){Richfaces.hideModalPanel('mpItem');}"/>
			</s:decorate>
		
			<ad:fieldset id="fsI" legenda="#{messages.item}">
			
				<s:decorate	template="/layout/edit.xhtml">
					<ui:define name="label">
						<h:outputText value="#{messages.nome}" />
					</ui:define>
					<h:inputText value="#{item.nome}" size="50" maxlength="50" required="true">
						<f:validateLength maximum="50" />
					</h:inputText>
				</s:decorate> 
				
				<s:decorate template="/layout/edit.xhtml">
					<ui:define name="label">
						<h:outputText value="#{messages.prioridade}" />
					</ui:define>
						
					<r:inputNumberSlider value="#{item.prioridade}" maxValue="10" minValue="1" required="true" showInput="false">
						<a:support event="onchange" reRender="prioridadeLabel" ajaxSingle="true"/>
					</r:inputNumberSlider>
					
					<h:panelGroup id="prioridadeLabel">
						<ui:include src="/pages/item/prioridade.xhtml">
							<ui:param name="valor" value="#{item.prioridade}" />
						</ui:include>
					</h:panelGroup>
	
				</s:decorate>			

				<s:decorate template="/layout/edit.xhtml">
					<ui:define name="label">
						<h:outputText value="#{messages.estimativa}" />
					</ui:define>
					<r:inputNumberSpinner value="#{item.estimativa}" step="0.5" required="true"/>
				</s:decorate> 
				
				<s:decorate template="/layout/edit.xhtml">
					<ui:define name="label">
						<h:outputText value="#{messages.descricao}" />
					</ui:define>
					<h:inputTextarea value="#{item.descricao}" rows="3" cols="50">
						<f:validateLength maximum="255" />
					</h:inputTextarea>
				</s:decorate> 
			
			</ad:fieldset>
	
		</h:form>
	</ui:component>
</html>